import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

public class Histogramm {

	static class HistogrammElement implements Comparable<HistogrammElement> {
		private final char character;
		private final int number;

		public HistogrammElement(int number, char character) {
			this.number = number;
			this.character = character;
		}

		@Override
		public int compareTo(HistogrammElement o) {
			return o.number - number;
		}

		public int getNumber() {
			return number;
		}

		public char getCharacter() {
			return character;
		}

		public String toString() {
			return getCharacter() + " : " + getNumber();
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if (args.length < 1) {
			System.out.println("Too few arguments");
			return;
		}
		int[][] histogramm = new int[Character.MAX_VALUE][3];
		int j = 0;
		for (char c : args[0].toCharArray()) {
			int i = (int) c;
			histogramm[i][j % 3]++;
			j++;
		}

		j = 0;
		for (; j < 3; j++) {
			System.out.println("j = " + j);
			List<HistogrammElement> queue = new LinkedList<Histogramm.HistogrammElement>();
			for (int i = 0; i < Character.MAX_VALUE; i++) {
				if (histogramm[i][j] > 0) {
					queue.add(new HistogrammElement(histogramm[i][j], (char) i));
				}
			}

			Collections.sort(queue);

			for (HistogrammElement e : queue) {
				System.out.println(e);
			}
			queue.clear();
			System.out.println("---------------------------");
		}
	}
}
